﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace YangtzeFilterTestSystem
{
    public partial class RowColum2XYForm : Form
    {
        uint FaceScanningXBlockNumber;

        public RowColum2XYForm()
        {
            InitializeComponent();
        }

        private void RowColumn2PosBtn_Click(object sender, EventArgs e)
        {
            FaceScanningXBlockNumber = Convert.ToUInt32(Math.Ceiling(Filter.FoldingLength / Probe.SettingVelocity));    //扫描的列数，对应扫描矩阵的列
            Probe.ActualVelocity = 1.0 * Filter.FoldingLength / FaceScanningXBlockNumber;         //此为实际的扫描速度，单位为 mm/s

            BlockRowPosTBox.Text = (Convert.ToDouble(BlockRowTBox.Text) * Probe.bp).ToString("N1");
            BlockColumnPosTBox.Text = ((Convert.ToDouble(BlockColumnTBox.Text) * Probe.ActualVelocity)).ToString("N1");
        }

        private void Pos2RowColumnBtn_Click(object sender, EventArgs e)
        {
            FaceScanningXBlockNumber = Convert.ToUInt32(Math.Ceiling(Filter.FoldingLength / Probe.SettingVelocity));    //扫描的列数，对应扫描矩阵的列
            Probe.ActualVelocity = 1.0 * Filter.FoldingLength / FaceScanningXBlockNumber;         //此为实际的扫描速度，单位为 mm/s

            BlockRowTBox.Text = (Math.Floor(Convert.ToDouble(BlockRowPosTBox.Text) / Probe.bp)).ToString("N0");
            BlockColumnTBox.Text = (Math.Floor(Convert.ToDouble(BlockColumnPosTBox.Text) / Probe.ActualVelocity)).ToString("N0");
        }
    }
}
